<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui">

<h:body>

    <p:growl id="growU" showDetail="true" life="3000" />

    <h:panelGrid columns="2" id="panelData">
        <h:outputText for="firstname" value="First name:*"/>
        <p:inputText id="firstname" value="#{usersBean.firstname}" required="true"
                     label="firstname">
        </p:inputText>

        <h:outputText for="lastname" value="Last name:*"/>
        <p:inputText id="lastname" value="#{usersBean.lastname}" required="true"
                     label="lastname"/>

        <h:outputText for="login" value="Login:*"/>
        <p:inputText id="login" value="#{usersBean.login}" required="true"
                     label="login" validator="#{usersValidation.validateLogin}">
            <f:validateLength minimum="4"/>
        </p:inputText>

        <h:outputText for="email" value="Email:*"/>
        <p:inputText id="email" value="#{usersBean.email}" required="true"
                     label="email" validator="#{usersValidation.validateEmail}">
            <f:validateLength minimum="5"/>
        </p:inputText>

        <h:outputText for="password1" value="Password:*"/>
        <p:password id="password1" value="#{usersBean.password}" required="true"
                    label="password1" match="password2">
            <f:validateLength minimum="6"/>
        </p:password>

        <h:outputText for="password2" value="Password:*"/>
        <p:password id="password2" value="#{usersBean.password}" required="true"
                    label="password2"/>

        <f:facet name="footer">
            <p:commandButton id="saveButton" update="growU" value="Save"
                             actionListener="#{usersBean.saveNewUser}"
                             oncomplete="handleCreateUserRequest(xhr, status, args)" />
        </f:facet>
    </h:panelGrid>
</h:body>
</html>